"""
import langchain

# 设置为详细输出模式
langchain.verbose = True

from langchain_openai import ChatOpenAI

llm = ChatOpenAI()
llm.invoke("Hello, world!")

"""
from openai import OpenAI
client = OpenAI(
    api_key="sk-gskfqqyvcayxexdtehxwmhjtlkfqqhygoffgunzvpqckdkov",
    base_url="https://api.siliconflow.cn/v1"
)

response = client.chat.completions.create(
    messages=[
    	# 把用户提示词传进来content
        {'role': 'user', 'content': "鲁迅为什么打周树人？"},
    ],
    model='deepseek-ai/DeepSeek-R1',  # 上面写了可以调用的模型
    stream=True  # 一定要设置True
)

for chunk in response:
    print(chunk.choices[0].delta.content, end="", flush=True)
